package com.joysuch.wwyt.mh.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.joysuch.wwyt.core.bean.SimpleIdMapping;
import com.joysuch.wwyt.mh.bo.MhMajorHazardTaskAssignBO;
import com.joysuch.wwyt.mh.entity.MhMajorHazardTaskAssign;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author zqw
 * @since 2022-05-24
 */
@Repository
public interface MhMajorHazardTaskAssignMapper extends BaseMapper<MhMajorHazardTaskAssign> {

    void updateStatusByTaskIdsAndUserId(@Param("taskIds")  List<Long> taskIds, @Param("userId") Long userId,@Param("doneStatus") Integer doneStatus);

    int deleteByTaskIds(@Param("taskIds") List<Long> taskIds);

    List<MhMajorHazardTaskAssign> findByTaskIds(@Param("taskIds") List<Long> taskIds,@Param("doneStatus") Integer doneStatus );

    List<MhMajorHazardTaskAssignBO> findByEndtimeAndStatus(@Param("time") long time, @Param("assignStatus")Integer assignStatus,@Param("taskStatus")Integer taskStatus);

    List<MhMajorHazardTaskAssign> findByIds(@Param("ids") List<Long> ids);

    List<MhMajorHazardTaskAssign> findByTaskId(@Param("taskId")Long taskId);

    List<SimpleIdMapping> findUserByTaskIds(@Param("taskIds") List<Long> taskIds);

    boolean deleteByTaskAndUsers(@Param("taskId") Long taskId,@Param("userIds") Collection<Long> userIds);

    int deleteByIds(@Param("ids") List<Long> ids);
//    int deleteByIdsV2(@Param("ids") String ids);
}
